clear all;

cd ..; cd ..; cd ..;
load('code_main_model\6_implied_w_r\input\comm_loc_model.mat');
cd 'code_figure_table\maintext\Figure 6';
load('comm_loc.mat');
comm_loc_data=comm_loc(:,1:11);

[num_data_bangkok,num_data_northern,num_data_southern,num_data_central,num_data_northeastern]=...
    num_branch(comm_loc_data);
[num_model_bangkok,num_model_northern,num_model_southern,num_model_central,num_model_northeastern]=...
    num_branch(comm_loc_model);

bangkok_data=num_data_bangkok(1:10);
bangkok_model=num_model_bangkok(1:10);

central_data=num_data_central(1:10);
central_model=num_model_central(1:10);

northern_data=num_data_northern(1:10);
northern_model=num_model_northern(1:10);

southern_data=num_data_southern(1:10);
southern_model=num_model_southern(1:10);

northeastern_data=num_data_northeastern(1:10);
northeastern_model=num_model_northeastern(1:10);

year=87:96;

figure('color', [1 1 1 ], 'Position',[200 50 1200 720]) 
subplot(2,3,1);
axis square
h1=plot(year, bangkok_model+central_model+northern_model+northeastern_model+southern_model, '-b',year, bangkok_data+central_data+northern_data+northeastern_data+southern_data, '--k', 'LineWidth', 2);
title('A. Whole country','Interpreter','Latex');
ylabel('number of new branches','Interpreter','Latex');
xlabel('year','Interpreter','Latex', 'FontSize',12); 
set(gca,'FontSize',12)
xlim([87 96]);
xticks([88:2:96]);
ylim([10,100])
leg1 = legend([h1], {'model', 'data'}, 'Location', 'Northwest','Interpreter','Latex','FontSize',12);
set(leg1,'Interpreter','latex');
box on;  

subplot(2,3,2)
axis square
h1=plot(year, bangkok_model, '-b', year, bangkok_data, '--k', 'LineWidth', 2);
title('B. Bangkok metropolitan','Interpreter','Latex');
ylabel('number of new branches','Interpreter','Latex');
xlabel('year','Interpreter','Latex', 'FontSize',12); 
set(gca,'FontSize',12)
xlim([87 96]);
xticks([88:2:96]);
box on;  


subplot(2,3,3);
axis square
h1=plot(year, central_model, '-b', year, central_data, '--k', 'LineWidth', 2);
title('C. Central','Interpreter','Latex');
ylabel('number of new branches','Interpreter','Latex');
xlabel('year','Interpreter','Latex', 'FontSize',12); 
set(gca,'FontSize',12)
xlim([87 96]);
xticks([88:2:96]);
box on;  


subplot(2,3,4);
axis square
h1=plot(year, northern_model, '-b', year, northern_data, '--k', 'LineWidth', 2);
title('D. North','Interpreter','Latex');
ylabel('number of new branches','Interpreter','Latex');
xlabel('year','Interpreter','Latex', 'FontSize',12); 
set(gca,'FontSize',12)
xlim([87 96]);
xticks([88:2:96]);
box on;  





subplot(2,3,5);
axis square
h1=plot(year, northeastern_model, '-b', year, northeastern_data, '--k', 'LineWidth', 2);
title('E. Northeast','Interpreter','Latex');
ylabel('number of new branches','Interpreter','Latex');
xlabel('year','Interpreter','Latex', 'FontSize',12); 
set(gca,'FontSize',12)
xlim([87 96]);
xticks([88:2:96]);
yticks(0:10:30)
box on;  

subplot(2,3,6);
axis square
h1=plot(year, southern_model, '-b', year, southern_data, '--k', 'LineWidth', 2);
title('F. South','Interpreter','Latex');
ylabel('number of new branches','Interpreter','Latex');
xlabel('year','Interpreter','Latex', 'FontSize',12); 
set(gca,'FontSize',12)
xlim([87 96]);
xticks([88:2:96]);
box on;  

